@extends('home/layout')

@if($script_blade = 'auth/register' )@endif

@section('content')
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <div class="panel panel-default">
                <div class="panel-body">
                    <ul class="nav nav-tabs">
                        <li role="presentation" @if(Request::input('type') != 'email' )class="active"@endif><a href="{{ url('auth/register') }}">手机注册</a></li>
                        <li role="presentation" @if(Request::input('type') == 'email' )class="active"@endif><a href="{{ url('auth/register?type=email') }}">邮箱注册</a></li>
                    </ul>
                    <p></p>
                    @if (count($errors) > 0)
                        <div class="alert alert-danger">
                            <strong>出错了~!</strong>
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif
                    @if(Request::input('type') != 'email')
                        <form action="{{ url('auth/register/register') }}" method="post">
                            <input type="hidden" name="type" value="mobile"/>
                            <input type="hidden" name="checkfield" value="{{ url('auth/register/checkfield') }}"/>
                            {!! csrf_field() !!}
                            <div class="form-group ">
                                <label for="mobile">手机号</label>
                                <input type="text" name="mobile" id="mobile" class="form-control "/>
                            </div>
                            <div class="form-group ">
                                <label for="name">昵称</label>
                                <input type="text" name="name" id="name" class="form-control"/>
                            </div>
                            <div class="form-group ">
                                <label for="password">密码</label>
                                <input type="password" name="password" id="password" class="form-control "/>
                            </div>
                            <div class="form-group ">
                                <label for="mobile_code">短信验证码</label>

                                <div class="controls row">
                                    <div class="col-md-6">
                                        <input type="text" class="form-control" id="mobile_code" name="mobile_code">
                                    </div>
                                    <div class="col-md-4">
                                        <span class="btn btn-default " id="get_mobile_code" data-url="{{ url('auth/register/mobilecode') }}">获取短信验证码</span>
                                    </div>
                                </div>
                            </div>
                            <p style="margin-bottom: 30px"></p>

                            <div class="form-group">
                                <div class="controls">
                                    <button type="submit" class="btn btn-primary btn-large btn-block">注册</button>
                                </div>
                            </div>
                        </form>
                    @else
                        <form action="{{ url('auth/register/register') }}" method="post">
                            <input type="hidden" name="type" value="mobile"/>
                            <input type="hidden" name="checkfield" value="{{ url('auth/register/checkfield') }}"/>
                            {!! csrf_field() !!}
                            <div class="form-group ">
                                <label for="mobile">邮箱</label>
                                <input type="text" name="mobile" id="mobile" class="form-control "/>
                            </div>
                            <div class="form-group ">
                                <label for="name">昵称</label>
                                <input type="text" name="name" id="name" class="form-control"/>
                            </div>
                            <div class="form-group ">
                                <label for="password">密码</label>
                                <input type="password" name="password" id="password" class="form-control "/>
                            </div>
                            <p style="margin-bottom: 30px"></p>
                            <div class="form-group">
                                <div class="controls">
                                    <button type="submit" class="btn btn-primary btn-large btn-block">注册</button>
                                </div>
                            </div>
                        </form>
                    @endif
                </div>

            </div>
        </div>
    </div>
@endsection